' Works In VB10 or Higher
' 
Public Module Ext_FormatWith
  <System.Runtime.CompilerServices.Extension()> _
  Public Function FormatWith(ByVal format As String, ByVal source As Object) As String
    Return FormatWith(format, Nothing, source)
  End Function

  <System.Runtime.CompilerServices.Extension()> _
  Public Function FormatWith(ByVal format As String, ByVal provider As IFormatProvider, ByVal source As Object) As String
    If format Is Nothing Then
      Throw New ArgumentNullException("format")
    End If

    Dim r As New Regex("(?<start>\{)+(?<property>[\w\.\[\]]+)(?<format>:[^}]+)?(?<end>\})+", RegexOptions.Compiled Or RegexOptions.CultureInvariant Or RegexOptions.IgnoreCase)

    Dim values As New List(Of Object)()
    Dim rewrittenFormat As String =
      r.Replace(format,
                Function(m As Match)
                  Dim startGroup As Group = m.Groups("start")
                  Dim propertyGroup As Group = m.Groups("property")
                  Dim formatGroup As Group = m.Groups("format")
                  Dim endGroup As Group = m.Groups("end")
                  values.Add(
                    If(propertyGroup.Value = "0",
                       source,
                       source.GetType.GetProperty(propertyGroup.Value).GetValue(source, Nothing, Nothing, Nothing, Nothing)
                      )
                    )
                  Return New String("{"c, startGroup.Captures.Count) & (values.Count - 1) & formatGroup.Value & New String("}"c, endGroup.Captures.Count)
                End Function)

    Return String.Format(provider, rewrittenFormat, values.ToArray())
  End Function


End Module


'
' Example Usage
'
'Public Module Module1
  '  Sub Main()
  '    Dim Invoice As New List(Of InvoiceItem)
  '    Invoice.Add(New InvoiceItem With {.Name = "Milk", .Price = 1D})
  '    Invoice.Add(New InvoiceItem With {.Name = "Coffee", .Price = 2.5D})
  '    Dim s As String = "The time is now {Name}".FormatWith(Invoice(1))
  '    Console.WriteLine(s)
  '    Console.ReadLine()
  '  End Sub

  'End Module

  'Public Class InvoiceItem
  '  Public Property Name As String
  '  Public Property Price As Decimal
  'End Class